define(['jquery', 'bootstrap', 'backend', 'addtabs', 'table', 'echarts', 'echarts-theme', 'template','form'], function ($, undefined, Backend, Datatable, Table, Echarts, undefined, Template,Form) {

    var Controller = {
        index: function () {
            // 基于准备好的dom，初始化echarts实例
            var barChart = Echarts.init(document.getElementById('bar-chart'), 'walden');
            let goods = Config.goods;
            option = {
                legend: {},
                tooltip: {},
                dataset: {
                    source: goods
                },
                xAxis: { type: 'category' },
                yAxis: {},
                // Declare several bar series, each will be mapped
                // to a column of dataset.source by default.
                series: [
                    { type: 'bar' },
                    { type: 'bar' },
                ]
            };
            // 使用刚指定的配置项和数据显示图表。
            barChart.setOption(option);

            $(window).resize(function () {
                barChart.resize();
            });

            $(document).on("click", ".btn-refresh", function () {
                setTimeout(function () {
                    barChart.resize();
                }, 0);
            });
            // 为表格绑定事件
            Form.events.daterangepicker($("form[role=form]"))

        },
        api: {
            bindevent: function () {
                Form.api.bindevent($("form[role=form]"));
            }
        }
    };

    return Controller;
});
